<template>
  <div v-if="async">
    <template v-if="widget.type=='NumberControl'">
      <el-input v-model="viewModel" type="number" placeholder="请输入" :size="size"/>
    </template>
    <template v-if="widget.type=='DecimalControl'">
      <el-input v-model="viewModel" type="number" :step="0.1" placeholder="请输入" :size="size"/>
    </template>
  </div>
</template>

<script>
export default {
  model: {
    prop: 'dataModel',
    event: 'change'
  },
  props: {
    widget: {},
    dataModel: {},
    size: {}
  },
  data() {
    return {
      async: false,
      viewModel: ''
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    async init() {        
      if (this.dataModel) {
        this.viewModel = this.dataModel        
      }
      this.async = true
    }
  }
}
</script>